package com.chemical.search.util.jme;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;

/**
 *@className:AnalysisJME.java
 *@classDescription:
 *@author:MChen
 *@createTime:2012-4-25
 */
public class AnalysisJME {
	
	/**
	 * 分析smiles，返回可检索的分子式
	 * @param smiles
	 * @return
	 */
	public static String analysisJme(String smiles){
		int length = smiles.length();
		for(int i=0; i<length; i++){
			String charat = smiles.substring(i,i+1);
			System.out.println(charat);
		}
//		List<String> list = (List<String>)Arrays.asList(smiles);
//		String[] output = list.toArray(new String[0]);
////		printStringArray(output);	
//		for(int i =0;i<output.length;i++){
//			System.out.println(output[i]);
//		}
//		char[] a = new char[smiles.length()];
//		for(int i=0;i<smiles.length();i++){
//		a[i]=smiles.charAt(i);
//		}
//		System.out.println(a);
//		byte[] str = smiles.getBytes();
//		System.out.println(str);
		return null;
	}
	
	/**
	 * 读取mol文件上传时的mol文件
	 * @param path
	 * @return
	 */
	public static String readMol(String path){
		StringBuffer buffer = new StringBuffer();
		File file = new File(path);
		FileReader fr;
		try {
			fr = new FileReader(file);
			BufferedReader br = new BufferedReader(fr);
			String line = null;
			// 整行整行读取信息
			while ((line = br.readLine()) != null) {
//				System.out.println(line);
				buffer = buffer.append(line+"\r\n");
			}
			System.out.println(buffer);
			br.close();
			fr.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	public static void main(String[] args) {
//		analysisJme("c2ccc(c1ccccc1)cc2");
		readMol("C:\\Users\\Administrator\\Desktop\\mol\\170530.mol");
//		String[] input = {"d", "f", "g", "a", "v"};
//		List<String> list = (List<String>)Arrays.asList(input);
////		printStringArray(input);
//		System.out.println(list);
//		Collections.sort(list);
//		String[] output = list.toArray(new String[0]);
////		printStringArray(output);	
//		for(int i =0;i<output.length;i++){
//			System.out.println(output[i]);
//		}
//		System.out.println(output);
	}
}




